#ifndef uiMainLayer_h
#define uiMainLayer_h

#include "cocos2d.h"
#include "extensions/cocos-ext.h"
#include "ui/CocosGUI.h"

class uiNodeLayer;
class uiDoubleClickChecker;
USING_NS_CC;
USING_NS_CC_EXT;
class uiMainLayer : public cocos2d::LayerColor, public ScrollViewDelegate, public ui::EditBoxDelegate
{
public:
    virtual ~uiMainLayer();
    virtual bool init() override;

    static cocos2d::Scene* scene();

    // a selector callback
    void menuCloseCallback(Ref* sender);

    // implement the "static create()" method manually
    CREATE_FUNC(uiMainLayer);
    
    
    virtual bool onTouchBegan(Touch *touch, Event *event) override;
    virtual void onTouchEnded(Touch *touch, Event *event) override;
    virtual void onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event) override;
    
    virtual void editBoxReturn( ui::EditBox* editBox ) override;
    
protected:
    uiNodeLayer* _nodeLayer;
    ScrollView* _scrollView;
    
    
    cocos2d::ui::EditBox* _editBox;
    
    uiDoubleClickChecker* _clickChecker;
};

#endif // uiMainLayer_h
